package com.store.client;


import com.carcenter.common.pojo.store.MyPageData;
import com.carcenter.common.pojo.store.SearchStoreDto;
import com.carcenter.common.pojo.store.StoreDto;
import com.carcenter.common.result.Result;
import com.store.client.fallback.StoreApiFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(
        value = "carcenter-service-store",
        fallback = StoreApiFallback.class)
public interface StoreApi {

    @GetMapping("/store-info/getStoreIdsByStoreName")
    public Result<List<Integer>> getStoreIdsByStoreName(@RequestParam("storeName") String storeName);
    @PostMapping("/store-info/getStoreDtosByIds")
    public Result<List<StoreDto>> getStoreDtosByIds(@RequestBody List<Integer> storeIds);

    @GetMapping("/store-info/getStationCountByStoreId/{storeId}")
    public Result<Integer> getStationCountByStoreId(@PathVariable("storeId") Integer storeId);

    @PostMapping("/store-info/getStoreList/{pageNum}/{pageSize}")
    public Result<MyPageData> getStoreList(
            @PathVariable("pageNum") Integer pageNum,
            @PathVariable("pageSize") Integer pageSize,
            @RequestBody(required = false) SearchStoreDto searchStoreDto);

}
